#!usr/bin/env python
# -*- coding:utf-8 _*-
"""
@author:zhengxin
@file: day3_08_list_class_grouping.py
@time: 2022/3/1  11:31
# @describe: 练习：班级分组⼩程序
"""

"""
需求：你们班有55⼈，每个⼈的姓名&考试成绩存在⼀个⼤列表⾥
    现要求按考试成绩⾼低将学员们分成5组，全存在⼀个新的⼤列表⾥, 
    5组分别是90-100, 80-89, 70-79,60-69, 0-59
    最终的数据格式如下：
        new_stu_list = [
        [
             ["Alex",100],
             ["Rain",91],
         ],
        [
             ["银⻆",79],
             ["Jack",78],
         ], 
        ....
         ....
"""

stu_list = [['李渊', 82], ['李世⺠', 7], ['侯君集', 5], ['李靖', 58], ['魏征', 1], ['房⽞龄', 64], ['杜如晦', 65],
            ['柴绍', 94], ['程知节', 45], ['尉迟恭', 94],['秦琼', 54], ['⻓孙⽆忌', 85], ['李存恭', 98], ['封德彝', 16],
            ['段志⽞', 44], ['刘弘基', 18], ['徐世绩', 86], ['李治', 19], ['武则天', 39], ['太平公主', 57], ['⻙后',76],
            ['李隆基', 95], ['杨⽟环', 33], ['王勃', 49], ['陈⼦昂', 91], ['卢照邻', 70],['杨炯', 81], ['王之涣', 82],
            ['安禄⼭', 18], ['史思明', 9], ['张巡', 15], ['雷万春', 72], ['李⽩', 61], ['⾼⼒⼠', 58], ['杜甫', 27],
            ['⽩居易', 5], ['王维', 14],['孟浩然', 32], ['杜牧', 95], ['李商隐', 34], ['郭⼦仪', 53], ['张易之', 39],
            ['张昌宗', 61], ['来俊⾂', 8], ['杨国忠', 84], ['李林甫', 95], ['⾼适', 100], ['王昌龄',40], ['孙思邈', 46],
            ['⽞奘', 84], ['鉴真', 90], ['⾼骈', 85], ['狄仁杰', 62], ['⻩ 巢', 79], ['王仙芝', 16], ['⽂成公主', 13],
            ['松赞⼲布', 47], ['薛涛', 79], ['⻥⽞机', 16], ['贺知章', 20], ['李泌', 17], ['韩愈', 100], ['柳宗元', 88],
            ['上官婉⼉ 五代⼗国：朱温', 55], ['刘仁恭', 6], ['丁会', 26], ['李克⽤', 39], ['李存勖', 11],['葛从周', 25],
            ['王建', 13], ['刘知远', 95], ['⽯敬瑭', 63], ['郭威', 28], ['柴 荣', 50], ['孟昶', 17], ['荆浩', 84],
            ['刘彟', 18], ['张及之', 45], ['杜宇', 73], ['⾼季兴', 39], ['喻皓', 50], ['历真', 70], ['李茂贞', 6],
            ['朱友珪', 7], ['朱友贞', 11], ['刘守光', 2]]

stu_groups = [
    [],     # 90-100
    [],     # 80-89
    [],     # 70-79
    [],     # 60-69
    [],     # 0-59
]

for i in stu_list:
    if i[1] >= 90:
        stu_groups[0].append(i)
    elif i[1] >= 80:
        stu_groups[1].append(i)
    elif i[1] >= 70:
        stu_groups[2].append(i)
    elif i[1] >= 60:
        stu_groups[3].append(i)
    else:
        stu_groups[4].append(i)

for group in stu_groups:
    print(group)
